package com.gistmap.ntdc.web;

import com.gistmap.ntdc.service.MerchantOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhangran
 * @date 2018/12/20
 */
@RestController
@RequestMapping("/order")
public class MerchantOrderController {

    @Autowired
    private MerchantOrderService merchantOrderService;

    /**
     * 下单
     * @param orderForm
     */
    @PostMapping
    public void add(MerchantOrderService.OrderForm orderForm){
        merchantOrderService.createOrder(orderForm);
    }

    /**
     * 支付成功回调
     * @param id
     * @param amount
     */
    @GetMapping("/callback")
    public void successCallBack(Long id, Integer amount){
        merchantOrderService.onPaySuccess(id, amount);
    }

}
